#ifndef _GD25Q_HAL_H_
#define	_GD25Q_HAL_H_

#include "stdint.h"
#include "sys.h"
#include "pincfg.h"


#ifdef _GD25Q_HAL_MODEL_
#define GD_EXT
#else
#define GD_EXT extern
#endif

#define Q25_SS PEout(3)

//WP# going low to protected the BP0~BP4 bits and SRP0~1 bits.
#define GD25WpEn()                                
#define GD25WpDis()                                
//To re-start communication with chip, the HOLD# must be at high and then CS# must be at low
//#define GD25Cs(x)                                // (x?(Q25_SS = 1 ):(Q25_SS = 0))
#define GD25Hold(x)                              

void gdSpiInit(void);
uint8_t dgSpiRw(uint8_t dataW);
uint8_t dgSpiWrite(uint8_t *dataw, uint32_t Len);
uint8_t dgSpiRead(uint8_t *datar, uint32_t Len);
void GD25Cs(uint8_t x);

void gdSpiDma(uint8_t NewState);
void gdSpiDmaRead(uint8_t *Data, uint32_t  Len);
void gdSpiDmaWrite(uint8_t *Data, uint32_t  Len);

#undef GD_EXT

#endif	/* _GD25Q_HAL_H_ */

